<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<h1 th:text="${title}"></h1>

<hr/>

<h2>产品信息</h2>
<dl>
    <dt>产品名称:</dt>
    <dd th:text="${product.description}">默认产品名称</dd>

    <dt>产品价格:</dt>
    <dd th:text="${'￥' + #numbers.formatDecimal(product.price, 1, 2)}">350</dd>

    <dt>产品有效时间:</dt>
    <dd th:text="${#dates.format(product.availableFrom, 'yyyy-MM-dd')}">28-Jun-2018</dd>
</dl>

<hr/>

<h2>字符串转义示例</h2>
<div th:text="${html}">Some escaped text</div>
<div th:utext="${html}">Some unescaped text</div>

<hr/>

<h2>迭代器示例</h2>
<table>
    <thead>
    <tr>
        <th>序号</th>
        <th>产品名称</th>
        <th>价格</th>
        <th>有效日期</th>
        <th>销售类型</th>
        <th>备注</th>
    </tr>
    </thead>
    <tbody th:remove="all-but-first">
    <tr th:each="product : ${products}">
        <td th:text="${productStat.count}">1</td>
        <td th:text="${product.description}">Red chair</td>
        <td th:text="${'￥' + #numbers.formatDecimal(product.price, 1, 2)}">￥350</td>
        <td th:text="${#dates.format(product.availableFrom, 'dd-MM-yyyy')}">2018-02-20</td>
        <td th:switch="${product.saleType}">
            <span th:case="'CG'">闪购</span>
            <span th:case="'PT'">拼团</span>
            <span th:case="'CX'">促销</span>
            <span th:case="*">其它</span>
        </td>
        <td><span th:if="${product.price gt 100}" class="offer">特殊提供</span></td>
    </tr>
    </tbody>
</table>

<hr/>

<h2>算术表达式</h2>
<p class="label">Four multiplied by minus six multiplied by minus
    two module seven:</p>
<p class="answer" th:text="${4 * -6 * -2 % 7}">123</p>

<h2>对象导航</h2>
<p class="label">Description  field of the
    third element of productList bean:</p>
<p class="answer"
   th:text="${products[2].description}">Product Description</p>

<h2>对象实例化</h2>
<p class="label">Current time milliseconds:</p>
<p class="answer" th:text="${new java.util.Date().getTime()}">22-Jun-2018</p>

<h2>T操作符</h2>
<p class="label">Random number:</p>
<p class="answer" th:text="${T(java.lang.Math).random()}">123456</p>

</body>
</html>